package com.aboo.action;

import com.aboo.service.ConsumerSampleService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/consumer")
public class ConsumerSampleAction {

    @Resource
    private ConsumerSampleService consumerSampleService;

    @RequestMapping("/sample")
    public Map<String, Object> sample() {
        Map<String, Object> result = new HashMap<>(8);
        result.put("flag", "Y");
        result.put("desc", "这是一个消费者测试");

        Map<String, String> data = consumerSampleService.sampleDate();
        result.put("data", data);
        log.info(JSONObject.toJSONString(result));

        return result;
    }

}
